<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="top">

        </ui:define>

        <ui:define name="left">

        </ui:define>
        <ui:define name="content">

            <h:form prependId="false" id="form"  >    

                <h:commandButton action ="EditRoles?faces-redirect=true" value="Return"/>
                <br></br>
                <p:dataTable  id ="list" value="#{ArsController.list}" var="right1" widgetVar="Table"
                              paginator="true" rows="10"  
                              paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                              selection="#{ArsController.selectedRole}" selectionMode="single"
                              rowSelectListener="#{ArsController.rightSelect}" > 
                    <p:column sortBy="#{right1.rightName}" filterBy="#{right1.rightName}">  
                        <f:facet name="header">  
                            <h:outputText value="Access Rights for #{ArsController.current.roleName}" /> 
                            <h:outputText value=" " /> 
                        </f:facet>  

                        <h:outputText value="#{right1.rightName}" />  
                    </p:column>  

                </p:dataTable>  
                <br />
                  <p:pickList value="#{ArsController.rightsPickList}"  
                            var="item"  
                            itemLabel="#{item}"  
                            itemValue="#{item}">
                    <f:facet name="sourceCaption">All Rights</f:facet>  
                    <f:facet name="targetCaption">#{ArsController.current.roleName}'s Access Rights</f:facet>
                </p:pickList>

                <p:commandButton ajax="false" value="Assign Rights" action ="#{ArsController.updateRoleRights}"/>
                
            </h:form>    
        </ui:define>
    </ui:composition>



</html>